home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / dd1a / dragdrop.bas < prev    next >
BASIC Source File  |  1995-05-09  |  1KB  |  36 lines

  1. DefInt A-Z
  2. 'all the code is in the Main() routine
  3. 'Main() is the startup routine for the Drag'N'Drop
  4. 'Paul Bonner  76000,13
  5.  
  6.  
  7.  
  8. Sub Main ()
  9. Totfiles = 0
  10. PM_NOREMOVE = 0
  11. PM_NOYIELD = 2
  12. wRemoveMsg = PM_NOREMOVE Or PM_NOYIELD   'parameters for PeekMessage call
  13. DragDropForm.Show
  14. Handle = DragDropForm.Hwnd
  15. Filenum = -1
  16. DragAcceptFiles Handle, True    'identify form as able to accept d/d messages
  17. Do While DoEvents()
  18.     x = PeekMessage(NewMessage, Handle, 563, 563, wRemoveMsg) 'determine if a d/d message is waiting
  19.     If x <> 0 Then  'if a dd message is waiting
  20.             'calling DragQueryFile with a -1 value for FileNum returns # of files dropped
  21.         x = DragQueryFile(NewMessage.wparam, Filenum, NameOfFile, 128)
  22.             For Counter = 0 To x - 1   ' for each file dropped
  23.                     'calling with a value greater than -1 returns name of corresponding file
  24.                 y = DragQueryFile(NewMessage.wparam, Counter, NameOfFile, 128)
  25.                     'add NameOfFile to List
  26.                 DragDropForm.list1.AddItem NameOfFile
  27.             Next Counter    'get next file
  28.             Totfiles = Totfiles + x
  29.             DragDropForm.label2.caption = Str$(x) + " files added. " + Str$(Totfiles) + " files in list."
  30.         'always call dragfinish to release d/d memory buffer
  31.     DragFinish NewMessage.wparam
  32.     End If
  33. Loop
  34. End Sub
  35.  
  36.